﻿namespace FiftyOne.Foundation.Mobile.Detection
{
    using System;
    using System.Collections.Generic;

    internal class Collection : Dictionary<int, int>
    {
        internal Collection()
        {
        }

        internal string Get(string capabilityName)
        {
            int num = 0;
            int index = Strings.IndexOf(capabilityName);
            if (base.TryGetValue(index, out num))
            {
                return Strings.Get(num);
            }
            return null;
        }

        internal void Set(string capabilityName, string value)
        {
            int key = Strings.Add(capabilityName);
            if (key >= 0)
            {
                lock (this)
                {
                    if (!base.ContainsKey(key))
                    {
                        base.Add(key, Strings.Add(value));
                    }
                    else
                    {
                        base[key] = Strings.Add(value);
                    }
                }
            }
        }
    }
}

